#! /bin/bash

#udevadm info --attribute-walk --name=/dev/ttyUSB0
ls /dev/ttyUSB*
sudo chmod 777 /dev/ttyUSB0
sudo chmod 777 /dev/ttyUSB1
sudo chmod 777 /dev/ttyUSB2

# sudo nano /etc/udev/rules.d/trobot.rules
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0005", MODE:="0777", SYMLINK+="lidar_n10"
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0002", MODE:="0777", SYMLINK+="stam32_f4"
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", MODE:="0777", SYMLINK+="rplidar_a1"
# fdilink_ahrs
# KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", GROUP:="dialout", SYMLINK+="fdilink_ahrs"
# wit_imu
KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", GROUP:="dialout", SYMLINK+="wit_imu" 

sudo service udev reload && sudo service udev restart
sudo udevadm trigger
ls -l /dev | grep ttyUSB